package com.tdd.zkconfig.controller;

import com.alibaba.druid.pool.DruidPooledConnection;
import com.tdd.zkconfig.utils.DruidUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * @author tudedong
 * @description
 * @date 2020-06-14 15:30:57
 */
@RestController
public class TestController {

    @RequestMapping(value = "/getTbResume",method= RequestMethod.GET)
    public String getTbResume(){

        String result="";
        try {
            //获取数据库连接
            DruidPooledConnection connection = DruidUtils.getInstance().getConnection();
            ResultSet resultSet = connection.prepareStatement("select * from tb_resume limit 1").executeQuery();
            resultSet.next();
            result = resultSet.getNString("address") + " | " + resultSet.getNString("name") + " | " + resultSet.getNString("phone");
            System.out.println(result);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return result;
    }
}
